package com.gis.school.gisserver.controller;

import com.gis.school.dto.UserDtoLogin;
import com.gis.school.result.Result;
import com.mybatisflex.core.paginate.Page;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.catalina.User;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.gis.school.gisserver.service.IUserService;
import com.gis.school.entity.UserEntity;

import java.io.Serializable;
import java.util.List;

/**
 * 控制层。
 *
 * @author mybatis-flex-helper automatic generation
 * @since 1.0
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;
    @PostMapping("/login")
    @Tag(name = "用户登录")
    public Result<String> loginController(@RequestParam String uname, @RequestParam String password){
        return  userService.loginService(uname, password);
    }

    @PostMapping("/register")
    @Tag(name = "用户注册")
    public Result<String> registController(@RequestBody UserDtoLogin newUser){
        return userService.registService(newUser);

    }

}